package com.ruoyi.web.controller.signer;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SignLog;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISignLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 个人签章日志Controller
 * 
 * @author ess
 * @date 2021-10-28
 */
@RestController
@RequestMapping("/signer/signLogSigner")
public class SignLogSignerController extends BaseController
{
    @Autowired
    private ISignLogService signLogService;

    /**
     * 查询个人签章日志列表
     */
    @PreAuthorize("@ss.hasPermi('signer:signLogSigner:list')")
    @GetMapping("/list")
    public TableDataInfo list(SignLog signLog)
    {
        LoginUser loginUser = getLoginUser();
        signLog.setSignUserId(loginUser.getUser().getPersonId());
        startPage();
        List<SignLog> list = signLogService.selectSignLogList(signLog);
        return getDataTable(list);
    }

    /**
     * 导出签章日志列表
     */
    @PreAuthorize("@ss.hasPermi('signer:signLogSigner:export')")
    @Log(title = "个人签章日志", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(SignLog signLog)
    {
        LoginUser loginUser = getLoginUser();
        signLog.setSignUserId(loginUser.getUser().getPersonId());
        List<SignLog> list = signLogService.selectSignLogList(signLog);
        ExcelUtil<SignLog> util = new ExcelUtil<SignLog>(SignLog.class);
        return util.exportExcel(list, "个人签章日志数据");
    }



}
